package action;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import vo.DogBean;
import dao.DogDao;

public class DogViewAction implements DogAction {

	@Override
	public void execute(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		DogDao dao = new DogDao();
		DogBean bean = null;
		boolean flag = dao.readCntUp(id);
		if(flag){
			DogDao dao1 = new DogDao();
			bean = dao1.getDog(id);
		}//if
		request.setAttribute("bean", bean);
		RequestDispatcher dis = request.getRequestDispatcher("./dogView.jsp");
		try {
			dis.forward(request, response);
		} catch (ServletException | IOException e) {
			e.printStackTrace();
		}//try~catch
	}//exe
}//class
